<script setup>
import { ref, useAttrs } from 'vue';
import { omit } from 'lodash-es';


defineOptions({
  inheritAttrs: false
});

const loading = ref(false);
const attrs = useAttrs();

async function handleClick() {
  console.log("attrs ===> ", attrs);
  
  loading.value = true;
  try {
    await attrs.onClick?.();
  } finally {
    loading.value = false;
  }
  
}

</script>
<template>
  <el-button v-bind="omit($attrs, 'onClick')" @click="handleClick" :loading="loading">
    <slot></slot>
  </el-button>
</template>
<style scoped>

</style>